// 用户模拟数据
import { UserVO } from '@/api/system/user/index'

// 模拟用户数据
const mockUsers: UserVO[] = [
  {
    id: '1',
    username: 'admin',
    nickname: '管理员',
    deptName: '管理部门',
    postName: '系统管理员',
    avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
    email: 'admin@example.com',
    mobile: '13800138000',
    status: '1',
    remark: '系统管理员',
    createTime: '2023-01-01 10:00:00',
    updateTime: '2023-01-01 10:00:00'
  },
  {
    id: '2',
    username: 'developer1',
    nickname: '开发人员1',
    deptName: '技术部',
    postName: '高级前端开发',
    avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
    email: 'developer1@example.com',
    mobile: '13800138001',
    status: '1',
    remark: '前端开发负责人',
    createTime: '2023-01-02 10:00:00',
    updateTime: '2023-01-02 10:00:00'
  },
  {
    id: '3',
    username: 'developer2',
    nickname: '开发人员2',
    deptName: '技术部',
    postName: '后端开发',
    avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
    email: 'developer2@example.com',
    mobile: '13800138002',
    status: '1',
    remark: '后端开发工程师',
    createTime: '2023-01-03 10:00:00',
    updateTime: '2023-01-03 10:00:00'
  },
  {
    id: '4',
    username: 'product',
    nickname: '产品经理',
    deptName: '产品部',
    postName: '高级产品经理',
    avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
    email: 'product@example.com',
    mobile: '13800138003',
    status: '1',
    remark: '产品负责人',
    createTime: '2023-01-04 10:00:00',
    updateTime: '2023-01-04 10:00:00'
  },
  {
    id: '5',
    username: 'designer',
    nickname: '设计师',
    deptName: '设计部',
    postName: 'UI设计师',
    avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
    email: 'designer@example.com',
    mobile: '13800138004',
    status: '1',
    remark: 'UI/UX设计师',
    createTime: '2023-01-05 10:00:00',
    updateTime: '2023-01-05 10:00:00'
  }
]

// 获取用户列表
export const getUserList = () => {
  return mockUsers
}

// 根据ID获取用户
export const getUserById = (id: string) => {
  return mockUsers.find(user => user.id === id)
}

// 搜索用户
export const searchUsers = (keyword: string) => {
  if (!keyword) return mockUsers
  keyword = keyword.toLowerCase()
  return mockUsers.filter(user => 
    user.username.toLowerCase().includes(keyword) ||
    user.nickname.toLowerCase().includes(keyword) ||
    user.mobile.includes(keyword)
  )
}